Source Property (Attachment Object) 

The Source property returns or sets the full path and filename, OLE class name, or unique message identifier for the attachment. Read/write.

Syntax

objAttachment.Source

Data Type

String

Remarks

The Source property returns or sets the full path and filename of the attachment data file for mapiFileData and mapiFileLink attachments. It returns or sets the OLE class name of the attachment for mapiOLE attachments. For mapiEmbeddedMessage attachments, the Source property is set with the ID1RMKEX8 property of the message to be embedded, and it returns the MessageC062VO object.

The OLE Messaging Library does not synchronize the Source property and the ReadFromFile7TMO9S method. For mapiFileData and mapiOLE attachments, when you change the Source property to indicate a different file, you must also explicitly call the ReadFromFile method to update the object data. Similarly, when you call ReadFromFile with data from a different file, you must change the Source property.

The return value of the Source property depends on the value of the TypeENNF7U property, as described in the following table:

Type property

Source property

mapiFileData

Not used; contains an empty string.

mapiFileLink

Specifies a full path name in a universal naming convention (UNC) format, such as \\SALES\INFO\PRODUCTS\NEWS.DOC.

mapiOLE

Specifies the registered OLE class name of the attachment, such as  Word.Document  or  PowerPoint.Show. 

mapiEmbeddedMessage

Specifies the embedded MessageC062VO object.

 

The UNC format is suitable for sending attachments to recipients who have access to a common file server.

The Source property corresponds to the MAPI property PR_ATTACH_PATHNAME.

Example

' from the function Attachments_Add()

    Set objAttach = objAttachColl.Add         ' add an attachment

    With objAttach

        .Type = mapiFileLink

        .Position = 0   ' place at end of message

        .Source = "\\server\bitmaps\honey.bmp"  ' UNC name

    End With

    ' must update the message to save the new info

    objOneMsg.Update   ' update the message

    MsgBox "Added an attachment of type mapiFileLink"

 

See Also

Add Method (Attachments Collection)YS6R2P